$def with(acts)
$var title: 地图
$var gmap: 1

<h1>地图</h1>
<div id="map" style="width: 100%; height: 600px"></div>
<script type="text/javascript">
    //<![CDATA[

    function load() {
      if (GBrowserIsCompatible()) {
        zoom_size = 11;
        var map = new GMap2(document.getElementById("map"));
        map.setUIToDefault();
        map.setCenter(new GLatLng(39.917, 116.397), zoom_size);
        var markers = [];
        var baseIcon = new GIcon(G_DEFAULT_ICON);

        baseIcon.shadow = "/static/marker/shadow.png";
        baseIcon.iconSize = new GSize(20, 34);
        baseIcon.shadowSize = new GSize(37, 34);
        baseIcon.iconAnchor = new GPoint(9, 34);
        baseIcon.infoWindowAnchor = new GPoint(9, 2);

        skatingIcon = new GIcon(baseIcon);
        skatingIcon.image = "/static/marker/skating.png";
        ridingIcon = new GIcon(baseIcon);
        ridingIcon.image = "/static/marker/riding.png";
        swimmingIcon = new GIcon(baseIcon);
        swimmingIcon.image = "/static/marker/swimming.png";
        eatingIcon = new GIcon(baseIcon);
        eatingIcon.image = "/static/marker/eating.png";


        function createMarker(point, name, time, id, type, join, wish, time) {
            if (type == "轮滑") {
                markerOptions = {icon: skatingIcon};
            } else if (type == "骑行") {
                markerOptions = {icon: ridingIcon};
            } else if (type == "游泳") {
                markerOptions = {icon: swimmingIcon};
            } else if (type == "腐败") {
                markerOptions = {icon: eatingIcon};
            } else {
                ;
            }

            var marker = new GMarker(point, markerOptions);
            markers[id] = marker;
            GEvent.addListener(marker, "click", function() {
                    var arr = new Array(
                        "<div class=\"pl\"><b>活动</b>: <a href=\"/activity?aid=" + 
                        id + "\">" + name + "</a>" + 
                        "<br> 时间:" + time + 
                        "<br> 参加人数:" + join + 
                        "<br> 感兴趣人数:" + wish + 
                        "<br> 集合时间:" + time + "</div>");
                    var str = arr.join("");
                    marker.openInfoWindowHtml(str);
                    });
            return marker;
        }

        $for i in acts:
            var point = new GLatLng($i['coordx'], $i['coordy']);
            map.addOverlay(createMarker(point, "$i['subject']", "$i['gathertime']", \
                        "$i['id']", "$i['type']", "$i['do']", "$i['wish']", "$i['gathertime']"));
      }
    }

    //]]>
</script>
